package com.example.data0306;

import android.annotation.SuppressLint;
import android.view.Gravity;
import android.view.View;
import android.widget.ImageView;

import androidx.drawerlayout.widget.DrawerLayout;

import com.example.data0306.base.BaseActivity;


public class Temp extends BaseActivity {
//    private DrawerLayout mDrawerLayout;
//
//    private View settingBtn;
//    private View scanView;
//    private ImageView userHeadView;
//    private View moreView;
//    private TextView userNameView;
//    private TextView levelView;
//    private TextView userSignatureView;
//    private RecyclerView menuListView;
//    private View rootContentView;
//    private LeftmenuAdapter mMenuAdapter;
//    private View drawerBtn;

    private DrawerLayout rootView;

    @Override
    protected int contentView() {
        return R.layout.view_main_left_navigation;
    }

    //@SuppressLint("WrongViewCast")
    @Override
    protected void initView() {
//        mDrawerLayout = findViewById(R.id.drawer_layout);
//
//        settingBtn = findViewById(R.id.ll_setting_btn);  //
//        scanView = findViewById(R.id.img_scan_btn);      //
//        userHeadView = findViewById(R.id.img_user_head); //
//        moreView = findViewById(R.id.img_more_btn);      //
//        userNameView = findViewById(R.id.tv_user_nick);  //
//        levelView = findViewById(R.id.tv_user_level);    //
//        userSignatureView = findViewById(R.id.tv_signature);  //
//        menuListView = findViewById(R.id.rv_menu_list);  //
//        rootContentView = findViewById(R.id.view_main_content);
//        drawerBtn = findViewById(R.id.img_drawer_btn);   //


        rootView = this.<DrawerLayout>findViewById(R.id.drawer_layout);
        //找到左边的头像布局
        ImageView view = findViewById(R.id.img_user_head1);
        //然后给头像设置一个新的图片
        view.setImageResource(R.drawable.icon_head_pic_3);


        findViewById(R.id.img_drawer_btn).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                rootView.openDrawer(Gravity.START);
            }
        });


    }

    @SuppressLint("RestrictedApi")
    @Override
    protected void initData() {
//        menuListView.setLayoutManager(new LinearLayoutManager(getContext()));
//        mMenuAdapter = new LeftmenuAdapter();
//        menuListView.setAdapter(mMenuAdapter);

    }

    @Override
    protected void bindData() {
//        super.bindData();
//        userNameView.setText("Ssnb");
//        levelView.setText("Lv3");
//        userSignatureView.setText("我是签名");
//
//        List<Left_menuBean> menuBeans = new ArrayList<>();
//        menuBeans.add(new Left_menuBean(R.drawable.ic_baseline_message_24, "我的评论"));
//        menuBeans.add(new Left_menuBean(R.drawable.ic_baseline_mail_24, "与我相关"));
//        menuBeans.add(new Left_menuBean(R.drawable.ic_baseline_assignment_24, "我的订单"));
//        menuBeans.add(new Left_menuBean(R.drawable.ic_baseline_check_box_24, "我的任务"));
//        menuBeans.add(new Left_menuBean(R.drawable.ic_baseline_loyalty_24, "我的收藏"));
//        menuBeans.add(new Left_menuBean(R.drawable.ic_baseline_card_giftcard_24, "活动中心"));
//        menuBeans.add(new Left_menuBean(R.drawable.ic_baseline_verified_user_24, "信用分"));
//        mMenuAdapter.addData(menuBeans);
//        userHeadView.setImageResource(R.drawable.icon_head_pic_3);
    }

    @Override
    protected void bindEvent() {

//        settingBtn.setOnClickListener(new View.OnClickListener() {
//            @Override
//            public void onClick(View v) {
//                Toast.makeText(getApplicationContext(), "跳转设置",Toast.LENGTH_SHORT).show();
//            }
//        });
//        scanView.setOnClickListener(new View.OnClickListener() {
//            @Override
//            public void onClick(View v) {
//                Toast.makeText(getApplicationContext(), "点击扫描",Toast.LENGTH_SHORT).show();
//            }
//        });
//        moreView.setOnClickListener(new View.OnClickListener() {
//            @Override
//            public void onClick(View v) {
//                Toast.makeText(getApplicationContext(), "点击更多",Toast.LENGTH_SHORT).show();
//            }
//        });
//
//        drawerBtn.setOnClickListener(v -> mDrawerLayout.openDrawer(GravityCompat.START));
//
//        mDrawerLayout.addDrawerListener(new DrawerLayout.SimpleDrawerListener() {
//            @Override
//            public void onDrawerSlide(View drawerView, float slideOffset) {
//                float diff = drawerView.getWidth() + drawerView.getX();
//                rootContentView.setTranslationX(diff);
//            }
//        });
    }
}


//    @Override
//    protected void onCreate(@Nullable Bundle savedInstanceState) {
//        super.onCreate(savedInstanceState);
//        setContentView(R.layout.activty_login);
//
//        Button button = (Button) findViewById(R.id.btn_denglu);
//        Button button1 = (Button) findViewById(R.id.btn_quxiao);
//
//        button.setOnClickListener(new View.OnClickListener() {
//            @Override
//            public void onClick(View v) {
//                TextView text = (TextView) findViewById(R.id.name);
//                String strtext = text.getText().toString();
//                EditText num = (EditText) findViewById(R.id.password);
//                String str = num.getText().toString();
//                if (str.equals("123456")) {
//                    Toast.makeText(MainActivity.this, strtext + "登陆成功", Toast.LENGTH_SHORT).show();
//                    Intent intent = new Intent();
//                    intent.setClass(MainActivity.this, Setting.class);
//                    startActivity(intent);
//                } else {
//                    Toast.makeText(MainActivity.this, "登陆失败，请重新输入密码", Toast.LENGTH_SHORT).show();
//                    num.setText(null);
//                }
//
//            }
//        });
//
//        button1.setOnClickListener(new View.OnClickListener() {
//            @Override
//            public void onClick(View v) {
//                TextView text = (TextView) findViewById(R.id.name);
//                text.setText(null);//将用户名一栏清空
//                EditText num = (EditText) findViewById(R.id.password);
//                num.setText(null);//将密码栏清空
//            }
//        });
//
//    }

